/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package measure2;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 *
 * @author emarkki
 */
public class Data {

    
    public static final String certNordiRootCA = "files/NordicRootCA.cer";
    public static final String certScandinaviaRootCA = "files/ScandinaviaRootCA.cer";
    public static final String certSwissRootCA = "files/SwissRootCA.cer";
    
    public static byte[] readBinaryFile(String fileName) throws IOException {
            
            InputStream in = Data.class.getResourceAsStream(fileName);
            
            if(in == null) {
                throw new IOException("No such file: " + fileName); // Note: Do not obfuscate this class!
            }
            
            ByteArrayOutputStream out = new ByteArrayOutputStream(1024);

            byte[] buffer = new byte[512];

            int ch;
            while ((ch = in.read(buffer)) > 0) {
                out.write(buffer, 0, ch);
            }
            in.close();

            return out.toByteArray();
    }
    
}
